﻿function myEdit(txtContent, atxtLength, txtContentwidth,txtLength)
{
    //alert("a");
    KindEditor.ready(function (K)
    {
        window.editor = K.create('#' + txtContent, {
            uploadJson: '/Scripts/upload.ashx',
            allowFileManager: false,
            width: txtContentwidth + 'px',
//            items: ['source', 'undo', 'redo', '|',
//                'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'insertorderedlist',
//                'insertunorderedlist', 'indent', 'outdent', 'subscript', 'superscript', 'clearhtml', 'quickformat', 'selectall', '|',
//                'fullscreen', '/', 'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|',
//                'image', 'multiimage', 'flash', 'media', 'insertfile', '|', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak', '|', 'anchor', 'link', 'unlink'],
            afterChange: function () {
                if (atxtLength.length > 0) K('#' + atxtLength).val(this.count());
                if (txtLength.length > 0) K('#' + txtLength).val(this.count('text'));
             },
            afterCreate: function ()
            {
                var self = this;
                K.ctrl(document, 13, function ()
                {
                    self.sync();
                    K('form[name=form1]')[0].submit();
                });
                K.ctrl(self.edit.doc, 13, function ()
                {
                    self.sync();
                    K('form[name=form1]')[0].submit();
                });
            }
        });
    });
}